Fix mach2phys table allocation for 32-bit PAE Xen.
authorkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 5 Aug 2005 15:11:46 +0000 (15:11 +0000)
committerkaf24@firebug.cl.cam.ac.uk <kaf24@firebug.cl.cam.ac.uk>
Fri, 5 Aug 2005 15:11:46 +0000 (15:11 +0000)
Found by Gerd Knorr.

xen/arch/x86/x86_32/mm.c

index ed6382cb92971fc1ce16f2d5c9d37eaa10c38a96..22021a8e36129b5d4beb1d97670abc5f55abce62 100644 (file)
@@ -98,8 +98,10 @@ void __init paging_init(void)
      * installed, but at least 4MB to cover 4GB address space.  This is needed 
      * to make PCI I/O memory address lookups work in guests.
      */
-    if ( (mpt_size = max_page * 4) < (4*1024*1024) )
-        mpt_size = 4*1024*1024;
+    mpt_size  = (max_page * 4) + (1UL << L2_PAGETABLE_SHIFT) - 1UL;
+    mpt_size &= ~((1UL << L2_PAGETABLE_SHIFT) - 1UL);
+    if ( mpt_size < (4 << 20) )
+        mpt_size = 4 << 20;
     for ( i = 0; i < (mpt_size >> L2_PAGETABLE_SHIFT); i++ )
     {
         if ( (pg = alloc_domheap_pages(NULL, PAGETABLE_ORDER, 0)) == NULL )